Skip to content

feat(typing): Add polars literal aliases#2352

Merged
MarcoGorelli merged 12 commits intomainfrom
polars-aliases
Apr 9, 2025
Merged

feat(typing): Add polars literal aliases#2352
MarcoGorelli merged 12 commits intomainfrom
polars-aliases

Conversation

@dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Apr 6, 2025

Closes #2359

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

Preview

API Reference (1)

image

API Reference (2)

image

IDE Hover

image

Not from `polars`, but describes the subset we support for `LazyFrame.unique`
Copied over unchanged, but seems they could do with standardising
- Following the existing pattern of `SizeUnit`, `TimeUnit`
- They appear in docs, but **not** in `nw.typing.__all__`
@dangotbanned dangotbanned added documentation Improvements or additions to documentation enhancement New feature or request typing labels Apr 6, 2025
- Use `-` for bullet lists
- Wrap literals in `"..."`
- Single space after `:`
- Titlecase for sentences
- Inline code for parameter names (e.g. ``on``)
- Wrap lines at ~80 characters
@dangotbanned dangotbanned marked this pull request as ready for review April 8, 2025 13:50
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcoGorelli MarcoGorelli merged commit e1526a8 into main Apr 9, 2025
27 of 28 checks passed
@MarcoGorelli MarcoGorelli deleted the polars-aliases branch April 9, 2025 14:44
@dangotbanned
Copy link
Member Author

68747470733a2f2f692e67697068792e636f6d2f6d656469612f76312e59326c6b505463354d4749334e6a45784d486b79634864744e6d786a4e445a345a5730795a6d4e70625849316354467a645764314d474e3462335178656a686f6333427362795a6c634431324d563970626e526c636d35686246396e61575a66596e6c666157516d593351395a772f4130654e3331706c6c433751632f67697068792e676966

Thanks @MarcoGorelli 😍

dangotbanned added a commit that referenced this pull request Apr 12, 2025
MarcoGorelli pushed a commit that referenced this pull request Apr 15, 2025
* fix(typing): Narrow `IntoDataFrame`

Will close #2344

* fix(typing): Remove `DataFrame` from `IntoFrame`

* fix(typing): Narrow `IntoLazyFrame`, `IntoFrame`

- Revealed two new `[overload-cannot-match]` from `mypy`
- I agreed with that and removed the conflict sources

Will close #2345

* fix(typing): Annotate `DataFrame._compliant_frame`

Revealed quite a few other issues

* chore: Add missing `CompliantDataFrame.pivot`

+ fix related quirks

* fix(typing): Ensure `__iter__` is available on group_by

* chore(typing): Fix most of `DataFrame`

* chore(typing): Ignore interchange `[type-var]`

* test(typing): Barely fix dodgy spark typing

- I think this whole test needs rewriting
- We shouldn't be depending on the internals like this

* fix: Implement `to_numpy` to catch args

https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.to_numpy.html

* fix(typing): Annotate `LazyFrame._compliant_frame`

* chore(typing): Ignore and add note for `spark_like` cast

* chore(typing): Partial `v1` backport

Spent waaaaaay too long trying to get this working

* fix(typing): Just preserve `v1` behavior

#2356 (comment)

* simplify

* try old `Union`

#2356 (comment)

* docs(typing): Provide more context on what and why

Expanded on (#2356 (comment))

* chore(typing): Use `Sequence[str]` in `pivot`

https://github.com/narwhals-dev/narwhals/pull/2356/files/5dd782522f23ed2aef3554a2aa89fc9903abd094#r2040702116

* refactor(typing): Use `PivotAgg`

#2352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request typing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enh]: Add polars._typing literal aliases

2 participants